﻿<controls:ChildWindow 
           x:Class="AdminModule.Views.SelectTargetCopyWindow"
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
           xmlns:struct="clr-namespace:AdminModule.UserControls.StructView"
           xmlns:common="clr-namespace:System.Windows;assembly=System.Windows.Controls"
           xmlns:classes="clr-namespace:AdminModule.CustomXAMLElements"
           xmlns:usercontrols="clr-namespace:AdminModule.UserControls.Common"
           xmlns:converters="clr-namespace:AdminModule.Converters"
           Width="720" Height="520"
           Loaded="ChildWindow_Loaded"
           Title="Куда копировать?">
    
    <controls:ChildWindow.Resources>
        <converters:BoolToVisibilityConverter x:Key="boolToVisibilityConverter"></converters:BoolToVisibilityConverter>
        
        <!--IndexMarlkStruct-->
        <common:HierarchicalDataTemplate x:Key="SectionLevel1" ItemsSource="{Binding Path=Childs2}">

            <classes:TemplateSelector Content="{Binding}">
                <classes:TemplateSelector.Templates>

                    <classes:IMDataTemplate IMName="AdmBaseClass">
                        <StackPanel Visibility="{Binding IsVisibility, Converter={StaticResource boolToVisibilityConverter}, Mode=TwoWay}" />
                    </classes:IMDataTemplate>

                    <classes:IMDataTemplate IMName="AdmSection">
                        <StackPanel Orientation="Horizontal">
                            <RadioButton Tag="{Binding}" GroupName="rbGroup" Checked="RadioButton_Checked" Unchecked="RadioButton_Checked"></RadioButton>
                            <Image Source="/IndexMarkSilverlightClient;Component/Views/Resources/Folder_Closed.png" Width="20" Height="20"/>
                            <TextBlock Padding="0" Text="{Binding Path=Order}" />
                            <TextBlock Text=" - "/>
                            <TextBlock Padding="0" Text="{Binding Path=Name}" />
                            <TextBlock Text=" (вес: "/>
                            <TextBlock Padding="0" Text="{Binding Path=Weight}" />
                            <TextBlock Text=")"/>
                        </StackPanel>
                    </classes:IMDataTemplate>

                </classes:TemplateSelector.Templates>
            </classes:TemplateSelector>

        </common:HierarchicalDataTemplate>

        <common:HierarchicalDataTemplate x:Key="SectionRootLevel" ItemsSource ="{Binding Path=Childs2}" ItemTemplate="{StaticResource SectionLevel1}">
            <StackPanel Orientation="Horizontal">
                <RadioButton Tag="{Binding}" GroupName="rbGroup" Checked="RadioButton_Checked" Unchecked="RadioButton_Checked"></RadioButton>
                <TextBlock Padding="0" Loaded="rootNode_Loaded" Text="{Binding Path=Name}" FontWeight="Bold" />
            </StackPanel>
        </common:HierarchicalDataTemplate>
        <!-- / IndexMarlkStruct-->

        <!--UniversityStruct-->
        <common:HierarchicalDataTemplate x:Key="DepartmentLevel1" ItemsSource="{Binding Path=Childs2}">

            <classes:TemplateSelector Content="{Binding}">
                <classes:TemplateSelector.Templates>

                    <classes:IMDataTemplate IMName="AdmBaseClass">
                        <StackPanel Visibility="{Binding IsVisibility, Converter={StaticResource boolToVisibilityConverter}, Mode=TwoWay}" />
                    </classes:IMDataTemplate>

                    <classes:IMDataTemplate IMName="AdmDepartment">
                        <StackPanel Orientation="Horizontal">
                            <RadioButton Tag="{Binding}" GroupName="rbGroup" Checked="RadioButton_Checked" Unchecked="RadioButton_Checked"></RadioButton>
                            <TextBlock Padding="0" Text="{Binding Path=Name}" />
                            <TextBlock Text=" (" />
                            <TextBlock Padding="0" Text="{Binding Path=Abbriviation}" />
                            <TextBlock Text=")" />
                        </StackPanel>
                    </classes:IMDataTemplate>

                </classes:TemplateSelector.Templates>
            </classes:TemplateSelector>

        </common:HierarchicalDataTemplate>

        <common:HierarchicalDataTemplate x:Key="DepartmentRootLevel" ItemsSource ="{Binding Path=Childs2}" ItemTemplate="{StaticResource DepartmentLevel1}">
            <StackPanel Orientation="Horizontal">
                <RadioButton Tag="{Binding}" GroupName="rbGroup" Checked="RadioButton_Checked" Unchecked="RadioButton_Checked"></RadioButton>
                <TextBlock Loaded="rootNode_Loaded" x:Name="rootNode" Text="{Binding Path=Name}" FontWeight="Bold" />
            </StackPanel>
        </common:HierarchicalDataTemplate>
        <!-- / UniversityStruct-->
        
        <!--GradationsStruct-->
        <common:HierarchicalDataTemplate x:Key="otherGradation" ItemsSource="{Binding Path=Childs2, Mode=TwoWay}">
            <StackPanel Visibility="{Binding IsVisibility, Converter={StaticResource boolToVisibilityConverter}, Mode=TwoWay}" Orientation="Horizontal">
                <RadioButton Tag="{Binding}" GroupName="rbGroup" Checked="RadioButton_Checked" Unchecked="RadioButton_Checked"></RadioButton>
                <TextBlock Padding="0" Text="{Binding Path=Order}" />
                <TextBlock Padding="0" Text=" " />
                <TextBlock Padding="0" Text="{Binding Path=Name}" />
                <TextBlock Padding="0" Text=" (вес: "/>
                <TextBox Padding="0" BorderThickness="0" FontWeight="Bold" Text="{Binding Path=Weight, Mode=TwoWay}" />
                <TextBlock Padding="0" Text=")"/>
            </StackPanel>
        </common:HierarchicalDataTemplate>

        <common:HierarchicalDataTemplate x:Key="mainGradation" ItemsSource ="{Binding Path=Childs2, Mode=TwoWay}" ItemTemplate="{StaticResource otherGradation}">
            <StackPanel Visibility="{Binding IsVisibility, Converter={StaticResource boolToVisibilityConverter}, Mode=TwoWay}" Orientation="Horizontal">
                <RadioButton Tag="{Binding}" GroupName="rbGroup" Checked="RadioButton_Checked" Unchecked="RadioButton_Checked"></RadioButton>
                <TextBlock FontStyle="Italic" Padding="0" Text="{Binding Path=Order, Mode=TwoWay}" />
                <TextBlock FontStyle="Italic" Padding="0" Text=". "/>
                <TextBlock TextWrapping="Wrap" MaxWidth="600" FontStyle="Italic" Padding="0" Text="{Binding Path=Name}" />
                <TextBlock FontStyle="Italic" Padding="0" Text=":"/>
            </StackPanel>
        </common:HierarchicalDataTemplate>

        <common:HierarchicalDataTemplate x:Key="GragationsRootLevel" ItemsSource ="{Binding Path=Childs2, Mode=TwoWay}" ItemTemplate="{StaticResource mainGradation}">
            <StackPanel Orientation="Horizontal">
                <RadioButton Tag="{Binding}" GroupName="rbGroup" Checked="RadioButton_Checked" Unchecked="RadioButton_Checked"></RadioButton>
                <TextBlock Padding="0" Loaded="rootNode_Loaded" Text="{Binding Path=Name, Mode=TwoWay}" FontWeight="Bold" />
            </StackPanel>
        </common:HierarchicalDataTemplate>
        <!-- / GradationsStruct-->
        
    </controls:ChildWindow.Resources>
    
    <Grid x:Name="LayoutRoot" Margin="2">
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <struct:IndexMarkStruct WithCharacteristics="False" Visibility="Collapsed" x:Name="indexMarkStruct"></struct:IndexMarkStruct>
        <struct:UniversityStruct WithRespondents="False" Visibility="Collapsed" x:Name="universityStruct"></struct:UniversityStruct>
        <struct:GradationsStruct Visibility="Collapsed" x:Name="gradationsStruct"></struct:GradationsStruct>

        <usercontrols:ProgressBar IsVisibility="Collapsed" VerticalAlignment="Center" HorizontalAlignment="Center" x:Name="progressBar"></usercontrols:ProgressBar>

        <Button x:Name="CancelButton" Content="Отмена" Click="CancelButton_Click" Width="75" Height="23" HorizontalAlignment="Right" Margin="0,12,0,0" Grid.Row="1" />
        <Button x:Name="OKButton" Content="OK" Click="OKButton_Click" Width="75" Height="23" HorizontalAlignment="Right" Margin="0,12,79,0" Grid.Row="1" />
    </Grid>
</controls:ChildWindow>